obj-c  = $(wildcard ./src/*.c) #.c文件夹
obj-o  = $(patsubst %.c, %.o, $(obj-c)) #.c转化为.o
target = main #目标

main_RELY = uart.o global.o sql.o pthread_init_destroy.o #目标依赖的文件

CFLAGS = -I ./include   #头文件文件夹
CC     = arm-none-linux-gnueabi-gcc -O0  #编译器
LDFLAGS= -pthread -L ./lib -lsqlite3 -lm #动态库


$(target):$(obj-o)
	$(CC) $^ -o $@ $(LDFLAGS) $(CFLAGS)


$(obj-o):%.o:%.c #obj-o的通用编译
	$(CC) -c $< -o $@ $(LDFLAGS) $(CFLAGS) 

main.o:$(main_RELY)

uart.o:timer.o uart_msg_queue.o

.PHONY:clean

clean:
	-rm $(target) $(obj-o)
	
